{include file="public/_meta" /}
{include file="public/_nav" /}

<div class="container body">
    <div class="col-xs-2">
        {include file="public/_left" /}
    </div>
    <div class="col-xs-10">
        <ol class="breadcrumb">
            导航位置：<li><a href="#">会员编辑</a></li>
        </ol>
        <h2>会员编辑</h2>
        <form action="#">
            <input type="hidden" name="id" value="{$userInfo.id}">
            <div class="form-group">
                <label for="username" class="control-label">用户名</label>
                <input type="text" class="form-control" id="username" disabled name="username" value="{$userInfo.username}" />
            </div>
            <div class="form-group">
                <label for="oldpass" class="control-label">原密码</label>
                <input type="password" class="form-control" id="oldpass" name="oldpass" placeholder="原密码">
            </div>
            <div class="form-group">
                <label for="password" class="control-label">新密码</label>
                <input type="password" class="form-control" id="password" name="password" placeholder="新密码">
            </div>
            <div class="form-group">
                <button class="btn btn-primary" id="useredit">修改</button>
                <button class="btn btn-success" type="reset">重置</button>
            </div>
        </form>
    </div>
</div>

{include file="public/_js" /}
<script>
    $('#useredit').click(function () {
       $.ajax({
           url:"{:url('admin/home/useredit')}",
           type:'post',
           data:$('form').serialize(),
           dataType:'json',
           success:function (data) {
               console.log(data);
               if (data.code == 1) {
                   layer.msg(data.msg, {
                       icon:6,
                       time:2000
                   }, function () {
                       location.href = data.url;
                   });
               }else {
                   layer.open({
                       title:'会员修改失败',
                       content:data.msg,
                       skin:'layui-layer-lan',
                       icon:5,
                       anim:6
                   });
               }
           }
       });
        return false;
    });
</script>
</body>
</html>